import { createRouter, createWebHistory } from 'vue-router'
// import HomeView from '@/views/HomeView.vue'
import InfoReportView from '@/views/InformationReportView.vue'
// import DataLibView from '@/views/DataLibView.vue'
import FlexDataLibView from '@/views/FlexDataLibView.vue'
import StrategyView from '@/views/ExcellentStrategyView.vue'
import PersonalCenterView from '@/views/PersonalCenterView.vue'
import CalculateView from '@/views/CalculateView.vue'
import ExDoctorView from '@/views/ExDoctorView.vue'
import FutureToolsView from '@/views/FutureToolsView.vue'
import HelpView from '@/views/HelpView.vue'

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: '/',
      name: 'home',
      component: () => import('@/views/HomeView.vue'),
    },
    {
      path: '/inforeport',
      name: 'inforeport',
      component: InfoReportView,
    },
    {
      path: '/strategy',
      name: 'strategy',
      component: StrategyView,
    },
    {
      path: '/datalib',
      name: 'datalib',
      component: () => import('@/views/DataLibView.vue'),
      // children: [
      //   {
      //     path: '/datalib/dataview',
      //     name: 'datalibDataView',
      //     component: () => import('@/views/DataLib/DataView.vue'),
      //   }
      // ]
    },
    {
      path: '/flexDatalib',
      name: 'flexDatalib',
      component: FlexDataLibView,
    },
    {
      path: '/calculate',
      name: 'calculate',
      component: CalculateView,
      children: [
        {
          path: '/calculate/variety',
          name: 'calculateVariety',
          component: () => import('@/views/Calculate/FormulaView.vue')
        }
      ]
    },
    {
      path: '/exdoctor',
      name: 'exdoctor',
      component: ExDoctorView,
      children: [
        {
          path: '/exdoctor/',
          name: 'exdoctorIndex',
          component: () => import('@/views/ExDoctor/Index.vue')
        },
        {
          path: '/exdoctor/synthensizeReport',
          name: 'synthensizeReport',
          component: () => import('@/views/ExDoctor/SynthensizeReport.vue')
        },
        {
          path: '/exdoctor/account/overview',
          name: 'accountOverview',
          component: () => import('@/views/ExDoctor/Account/Overview.vue')
        },
        {
          path: '/exdoctor/account/netvalue',
          name: 'accountNetvalue',
          component: () => import('@/views/ExDoctor/Account/NetValue.vue')
        },
        {
          path: '/exdoctor/account/periodProfit',
          name: 'accountPeriodProfit',
          component: () => import('@/views/ExDoctor/Account/PeriodProfit.vue')
        },
        {
          path: '/exdoctor/exclose/overview',
          name: 'excloseOverview',
          component: () => import('@/views/ExDoctor/ExStatistics/ClosePosOverview.vue')
        },
        {
          path: '/exdoctor/exclose/bsprofit',
          name: 'excloseBsprofit',
          component: () => import('@/views/ExDoctor/ExStatistics/ClosePosBsProfit.vue')
        },
        {
          path: '/exdoctor/exclose/varprofit',
          name: 'excloseVarprofit',
          component: () => import('@/views/ExDoctor/ExStatistics/ClosePosVarietyProfit.vue')
        },
        {
          path: '/exdoctor/exclose/periodType',
          name: 'exclosePeriodType',
          component: () => import('@/views/ExDoctor/ExStatistics/ClosePosPeriodType.vue')
        },
        {
          path: '/exdoctor/exstat/blockprofit',
          name: 'exstatBlockprofit',
          component: () => import('@/views/ExDoctor/ExStatistics/ExStatBlockProfit.vue')
        },
        {
          path: '/exdoctor/exstat/varstruct',
          name: 'exstatVarstruct',
          component: () => import('@/views/ExDoctor/ExStatistics/ExStatVarietyStruct.vue')
        },
        {
          path: '/exdoctor/mixevaluate/radar',
          name: 'mixevaluateRadar',
          component: () => import('@/views/ExDoctor/MixEvaluate/RadarAppraise.vue')
        },
        {
          path: '/exdoctor/mixevaluate/synthensize',
          name: 'mixevaluateSynthensize',
          component: () => import('@/views/ExDoctor/MixEvaluate/Synthensize.vue')
        },
      ]
    },
    {
      path: '/ftools',
      name: 'ftools',
      component: FutureToolsView,
      children: [
        {
          path: '/ftools/spreadArbitrage',
          name: 'spreadArbitrage',
          component: () => import('@/views/FutureTools/SpreadArbitrage.vue')
        },
        {
          path: '/ftools/positionAnalysis',
          name: 'positionAnalysis',
          component: () => import('@/views/FutureTools/PositionAnalysis.vue')
        },
      ],
    },
    {
      path: '/help',
      name: 'help',
      component: HelpView,
    },
    {
      path: '/mycenter',
      name: 'mycenter',
      component: PersonalCenterView,
    }
  ]
})

// router.beforeEach((to) => {
//   const hasLogin = getStorage(ruizhiLoginKey)
//   const greenRoutes = ['/', '/help']
//   if ((!hasLogin || hasLogin === 0) && greenRoutes.indexOf(to.path) < 0) {
//    
//   }
// })

export default router
